home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pbaseiv.zip / P4DOS001.TIP < prev    next >
Text File  |  1991-12-16  |  3KB  |  66 lines

  1. Dear Friends:
  2.  
  3. In the item "Improving WHEREIS" [Star-Dot-Star, November
  4. 1989], John East reveals some, but not all, of ATTRIB's
  5. hidden possibilities. This command is the unexploited gold
  6. mine of DOS commands.
  7.  
  8. For example, ATTRIB lets you batch process a routine that
  9. otherwise must be done a file at a time. Suppose you have a
  10. program that accepts individual files for processing but
  11. can't handle wild cards. (We have many such programs in
  12. Russia--for example, PRRUS.COM, which I use to print Russian
  13. fonts.) The standard solution is to create a batch file that
  14. calls a program like PRRUS for each file in a directory.
  15. ATTRIB lets me create such batch files automatically.
  16.  
  17. First, I make a copy of the program file I want to run and
  18. rename it A.COM or A.EXE. Next, I copy to a temporary
  19. directory all the files I want to process (this isn't
  20. strictly necessary, but I recommend it as a safety measure).
  21. I then enter the command attrib +a -r *.* (or *.TXT, or
  22. whatever). This switches on the archive bit for each file.
  23. Then, I enter attrib *.* > otp.bat to create a batch file
  24. named OTP.BAT. You can use another name if you like. The
  25. file will contain lines like these: A c:\Spath\Sfilename1 A
  26. c:\Spath\Sfilename2
  27.  
  28. The `A' in these lines represents the file's archive flag,
  29. which the first ATTRIB command switched on. However, since
  30. I've renamed my executable file to `A', executing the
  31. ATTRIB-created batch file passes all my file names to the
  32. program for processing, and I don't have to type a single
  33. one.
  34.  
  35. Vadim V. Kayuitkin
  36. Sverdlovsk, U.S.S.R.
  37.  
  38. Editor's note: The `-r' option in the first ATTRIB command
  39. is needed only if some files are set to read-only status,
  40. but it does no harm to include this option, especially if
  41. you've copied your files to another directory first. DOS's
  42. read-only setting is pretty worthless, anyway; programs can
  43. circumvent it without even knowing it.
  44.  
  45. Be aware that renaming some programs may cause them to fail
  46. if they search for their own files--for configuration
  47. information, for instance. In that case, instead of renaming
  48. your program, edit the batch file, replacing each `A' with
  49. your program's real name. Also, never change an executable
  50. program's extension. It's probably OK to rename MYPROG.EXE
  51. to A.EXE and MYPROG.COM to A.COM, but never rename an EXE
  52. extension to COM or vice versa. And whatever the program
  53. file is called, it must be in a directory on your PATH.
  54.  
  55. Try this tip even if you don't need to pass multiple files
  56. to programs in exactly this way. As Mr. Kayuitkin suggests,
  57. ATTRIB is truly golden for creating lists of file path
  58. names--a trick that no other DOS command performs with the
  59. same ease.
  60.  
  61. Title: A is for Action
  62. Category: DOS
  63. Issue date: Feb 1991
  64. Editor: Tom Swan
  65. Supplementary files: NONE
  66.